<?php
$this->display('public/header.phtml', array(
    "title" => "分类列表",
    "styles" => '',
    "crumbArr" => array(
        array("title" => "分类列表"),
    ),
));
?>
    <!--end搜索-->
    <div class="row">
        <div class="col-xs-12">
            <div class="row">
                <div class="col-xs-12">
                    <form class="form-inline form-search">
                        <a class="btn btn-sm btn-primary" href="/admin/category/add/">增加分类</a>
                    </form>
                    <div class="space-4"></div>

                    <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>分类名称</th>
<!--                            <th>所属父类</th>-->
                            <th>增加时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>

                        <tbody>
                        <?php foreach ($result as $row): ?>
                            <tr>
                                <td><?php echo $row['category_id']; ?></td>
                                <td><?php echo $row['category_name']; ?></td>
<!--                                <td>-->
<!--                                    --><?php
//                                    if ($row['parent_category_id']) {
//                                        echo $row['parent_category_info']['category_name'];
//                                    } else {
//                                        echo "-";
//                                    }
//                                    ?>
<!--                                </td>-->
                                <td>
                                    <?php if ($row['add_time']): ?>
                                        <?php echo date("Y-m-d H:i:s", $row['add_time']); ?>
                                    <?php endif; ?>
                                </td>
                                <td>
                                    <a href="/admin/category/edit/?category_id=<?php echo $row['category_id']; ?>">
                                        编辑
                                    </a>
                                </td>
                            </tr>
                            <?php if ($row['child_category_list']): ?>
                                <?php foreach ($row['child_category_list'] as $item): ?>
                                    <tr>
                                        <td><?php echo $item['category_id']; ?></td>
                                        <td>
                                            &nbsp;&nbsp;&nbsp;&nbsp;
                                            |-<?php echo $item['category_name']; ?>
                                        </td>
<!--                                        <td>-->
<!--                                            --><?php
//                                            if ($item['parent_category_id']) {
//                                                echo $item['parent_category_info']['category_name'];
//                                            } else {
//                                                echo "-";
//                                            }
//                                            ?>
<!--                                        </td>-->
                                        <td>
                                            <?php if ($item['add_time']): ?>
                                                <?php echo date("Y-m-d H:i:s", $item['add_time']); ?>
                                            <?php endif; ?>
                                        </td>
                                        <td>
                                            <a href="/admin/category/edit/?category_id=<?php echo $item['category_id']; ?>">
                                                编辑
                                            </a>
                                        </td>
                                    </tr>
                                <?php endforeach; ?>
                            <?php endif; ?>
                        <?php endforeach; ?>
                        </tbody>
                    </table>
                    <?php $this->display('public/pagination.phtml', array('paginator' => $this->paginator->style1())); ?>
                </div>
            </div>
        </div><!-- /.col -->
    </div><!-- /.row -->

    <script type="text/javascript">

    </script>

<?php
$this->display("public/footer.phtml", array(
    "scripts" => ''
));
?>
<?php $this->display("public/list_footer.phtml"); ?>
<?php $this->display("public/footer_body.phtml"); ?>